# Contributor: Sam Nystrom <sam@samnystrom.dev>
# Maintainer: Sam Nystrom <sam@samnystrom.dev>
pkgname=lutgen
pkgver=0.11.2
pkgrel=0
pkgdesc="Blazingly fast interpolated LUT generator and applicator for arbitrary and popular color palettes"
url="https://github.com/ozwaldorf/lutgen-rs"
arch="all"
license="MIT"
makedepends="cargo cargo-auditable"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-zsh-completion
	$pkgname-fish-completion
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/ozwaldorf/lutgen-rs/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/lutgen-rs-$pkgver"
options="net" # cargo fetch

prepare() {
	default_prepare
	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
	mkdir -p completions
	./target/release/lutgen --bpaf-complete-style-bash > completions/lutgen
	./target/release/lutgen --bpaf-complete-style-zsh > completions/_lutgen
	./target/release/lutgen --bpaf-complete-style-fish > completions/lutgen.fish
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/lutgen "$pkgdir"/usr/bin/lutgen
	install -Dm644 docs/lutgen.1 "$pkgdir"/usr/share/man/man1/lutgen.1
	install -Dm644 completions/lutgen "$pkgdir"/usr/share/bash-completion/completions/lutgen
	install -Dm644 completions/_lutgen "$pkgdir"/usr/share/zsh/site-functions/_lutgen
	install -Dm644 completions/lutgen.fish "$pkgdir"/usr/share/fish/vendor_completions.d/lutgen.fish
}

sha512sums="
4c0c67e37e8a106e5c2250de48048622fe4a8832ab846a357cc54311ecac06ed53d3af02ac7cd2380ea53719c5ab8028f5de9ee53a347627ca0e4b1496cdfdcb  lutgen-0.11.2.tar.gz
"
